﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace mesRUpload
{
    public static class Timing
    {
        private static DateTime st;
        private static DateTime et;

        public static string startTime()
        {
            return st.ToString("yyyy-MM-dd_HH:mm:ss:fff");
        }

        public static string start()
        {
            st = DateTime.Now;
            return st.ToString("yyyy-MM-dd_HH:mm:ss:fff");
        }

        public static string end()
        {
            et = DateTime.Now;
            return et.ToString("yyyy-MM-dd_HH:mm:ss:fff");
        }

        public static string spendTime()
        {
            return et.Subtract(st).TotalMilliseconds.ToString();
        }

        public static string exceptionMess(Exception e)
        {
            return "{\"Exception\":[\"Message\":\"" + e.Message.ToString() + "\""
                //+ ",\"Source\":\"" + e.Source.ToString() + "\""
                //+ ",\"TargetSite\":\"" + e.TargetSite.ToString() + "\""
                //+ ",\"StackTrace\":\"" + e.StackTrace.ToString() + "\""
                    + "]}";
        }
    }
}
